package com.sandasai.action.student;
import javax.annotation.Resource;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import com.sandasai.service.StudentManager;
import com.sandasai.vo.StudentBean;

@Controller
@Scope("prototype")
public class AddInfoAction extends ActionSupport {
    
    /**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private String bankCardId;
    private String grade;
    private String otherInfo;
    private String realName;
    private String studentNo;
    private String tel;
    private String college;
    @Resource
	private StudentManager studentManager;
    public String getBankCardId() {
        return bankCardId;
    }
    public void setBankCardId(String bankCardId) {
        this.bankCardId = bankCardId;
    }
    public String getGrade() {
        return grade;
    }
    public void setGrade(String grade) {
        this.grade = grade;
    }
    public String getOtherInfo() {
        return otherInfo;
    }
    public void setOtherInfo(String otherInfo) {
        this.otherInfo = otherInfo;
    }
    public String getRealName() {
        return realName;
    }
    public void setRealName(String realName) {
        this.realName = realName;
    }
    public String getStudentNo() {
        return studentNo;
    }
    public void setStudentNo(String studentNo) {
        this.studentNo = studentNo;
    }
    public String getTel() {
        return tel;
    }
    public void setTel(String tel) {
        this.tel = tel;
    }
    /**
     * @return
     */
    public String execute() {
        StudentBean studentBean = new StudentBean();
        studentBean.setBankCardId(bankCardId);
        studentBean.setGrade(grade);
        studentBean.setOtherInfo(otherInfo);
        studentBean.setRealName(realName);
        studentBean.setStudentNo(studentNo);
        studentBean.setTel(tel);
        studentBean.setCollege(college);
        ActionContext ctx = ActionContext.getContext();
        studentBean.setUsername((String) ctx.getSession().get("username"));
        if(studentManager.addInfo(studentBean)) {
            return SUCCESS;
        }else {
            return ERROR;
        }
    }
    public String getCollege() {
        return college;
    }
    public void setCollege(String college) {
        this.college = college;
    }
}